import { ts, SwitchStatement, rule, BreakStatement, is } from "qvog-dsl";

const SEVERITY = 2;
const DOC_PATH = 'docs/default-case-check.md';
const DESCRIPTION = 'Expected a default case';

export default rule()
    .match(SwitchStatement)
    .when((node): boolean => {
        return !ts.isDefaultClause(node.caseBlock.clauses[node.caseBlock.clauses.length - 1]);
    })
    .report({
        severity: SEVERITY,
        description: DESCRIPTION,
        docPath: DOC_PATH,
    });
